#include "testApp.h"

//--------------------------------------------------------------
void testApp::setup(){

    prevTime = ofGetElapsedTimeMillis();
    
    startTime = ofGetElapsedTimeMillis();
    endTime = startTime + 2000;
    endTime2 = startTime + 6000;
    
    ofSetFrameRate(10);
}

//--------------------------------------------------------------
void testApp::update(){
    //x++;
    
    x += 30 * ((ofGetElapsedTimeMillis() - prevTime)/1000.0);
    prevTime = ofGetElapsedTimeMillis();
    
    timer.update();
}

//--------------------------------------------------------------
void testApp::draw(){

    ofCircle(x, ofGetHeight()/2, 100);
    
    timer.draw();
    
    if(ofGetElapsedTimeMillis() > endTime &&
       ofGetElapsedTimeMillis() < endTime2){
        ofCircle(ofGetWidth()/2, ofGetHeight()/2, 100);
    }
}

//--------------------------------------------------------------
void testApp::keyPressed(int key){

    timer.trigger();
}

//--------------------------------------------------------------
void testApp::keyReleased(int key){

}

//--------------------------------------------------------------
void testApp::mouseMoved(int x, int y ){

}

//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){

}

//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){

}

//--------------------------------------------------------------
void testApp::mouseReleased(int x, int y, int button){

}

//--------------------------------------------------------------
void testApp::windowResized(int w, int h){

}

//--------------------------------------------------------------
void testApp::gotMessage(ofMessage msg){

}

//--------------------------------------------------------------
void testApp::dragEvent(ofDragInfo dragInfo){ 

}